/*
 * Cliquer.h
 *
 *  Created on: Jan 24, 2014
 *      Author: ik
 */

#ifndef CLIQUER_H_
#define CLIQUER_H_

#include <climits>
#include <cfloat>
#include <VertexSet.h>
#include <ProjectableVertexSet.h>
#include <IntValueArray.h>
#include <DoubleValueArray.h>

using namespace std;

class ComplParamSet;

// Interfaz para representar algoritmos de clique
class Cliquer
{
protected:
	ComplParamSet& getComplParamSet(int n);

public:
	Cliquer() {};
	virtual ~Cliquer() {};
	virtual int optimize(const VertexSet &subgrafo, ProjectableCliqueSet &clique, int cotaInferior=0,
			int cotaSuperior=INT_MAX, int tolerancia=0) = 0;
	virtual int optimize(const IntValueArray& pesos, const VertexSet &subgrafo,
			ProjectableCliqueSet &clique, int cotaInferior=0, int cotaSuperior=INT_MAX, int tolerancia=0) = 0;
	virtual double optimize(const DoubleValueArray& pesos, const VertexSet &subgrafo,
			ProjectableCliqueSet &clique, double cotaInferior=0.0, double cotaSuperior=DBL_MAX, double tolerancia=0.0) = 0;
};

class ComplParamSet : public VertexSet
{
	friend class Cliquer;

	ComplParamSet(int n) : VertexSet(n) {};
public:

	void retainAll(const BitMapSet &otro);
	void removeAll(const BitMapSet &otro);
};

inline ComplParamSet& Cliquer::getComplParamSet(int n)
{
	return *(new ComplParamSet(n));
}

/*!
 * If \c otro does not implement VertexSet, then an error occurs.
 */
inline void ComplParamSet::retainAll(const BitMapSet &otro)
{
	VertexSet::removeAll(otro);
}

/*!
 * If \c otro does not implement VertexSet, then an error occurs.
 */
inline void ComplParamSet::removeAll(const BitMapSet &otro)
{
	VertexSet::retainAll(otro);
}

#endif /* CLIQUER_H_ */
